[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 isascii()               Test for ASCII Character (Macro)

 #include   <ctype.h>

 int        isascii(c);
 int        c;                           Integer to be tested

    isascii() tests whether 'c' is a member of the 7-bit ASCII character
    set; that is, if:

                        0  <=  'c'  <= 127

       Returns:     True (nonzero) if the integer satisfies the test
                    condition and false (zero) if it does not.

         Notes:     isascii() is a macro.

   -------------------------------- Example ---------------------------------

    The following statements get input from stdin, testing that only
    ASCII characters are stored.

           #include <ctype.h>
           #include <stdio.h>

           int x = 0;
           char buffer[80];
           int ch;

           main()
           {
              while (isascii(ch = getche()) && ch != '~')
                    buffer[x++] = ch;
              printf("data input from console: %s \n",buffer);
           }


See Also: isalpha() isalnum() iscntrl() isdigit()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson